package com.example.act6.common.exception;


import java.util.Arrays;


public class CommonSystemException extends Exception{

    private String code;
    private String message;
    private String[] params;

    private CommonSystemException(){}

    public CommonSystemException(String code) {
        super(code);
        this.code = code;
    }

    public CommonSystemException(String code,String message) {
        super(code);
        this.code = code;
        this.message = message;
    }

    public CommonSystemException(String code,String message,String[] params) {
        super(code);
        this.code = code;
        this.message = message;
        this.params = params;
    }

    public CommonSystemException(String code,String message,Throwable cause) {
        super(code,cause);
        this.code = code;
        this.message = message;
    }

    public CommonSystemException(String code,String message,String[] params,Throwable cause) {
        super(code,cause);
        this.code = code;
        this.message = message;
        this.params = params;
    }

    public CommonSystemException(String code,String message,String params,Throwable cause) {
        super(code,cause);
        this.code = code;
        this.message = message;
        this.params = new String[]{params};
    }

    @Override
    public String toString() {
        return "CommonSystemException{" +
                "code='" + code + '\'' +
                ", message='" + message + '\'' +
                ", params=" + Arrays.toString(params) +
                '}';
    }
}
